<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>hello world</title>
  <SCRIPT type="text/javascript" src="jQuery/jquery-1.3.2.min.js"></script>
        <SCRIPT type="text/javascript">
            function clickButton()
            {    
                var url = 'ajaxRequest.action';
                var params = {
                        name:$('#name').attr('value')
                };
                
                // ajax  post 运用！
                jQuery.post(url, params, callbackFun, 'json');
            }
            function callbackFun(data)
            {
                alert(data.result);//对应HelloWorld类的message属性
                    //获取数据后渲染页面
            }
 </SCRIPT>

  </head>
  
  <body>
    This is my JSP page. <br>
    
    
    <input id="name" type="text"/>
    <input type="button" value="ok" onclick="javascript:clickButton();"/>
  </body>
</html>
